<template>
    <view> {{ count }} </view>

    <button @click="addCount" type="primary">count++</button>
    <button @click="count--">count--</button>

</template>
<script lang="ts" setup>
import { ref } from 'vue';

const count = ref(0)

const addCount = () => {
    if (count.value >= 10) {
        uni.showToast({
            title: '最大为10',
            icon: 'none',
            mask: true  //遮罩, 等提示消失才允许点击
        })
        return
    }
    count.value++
}

</script>
